Skip to content

[pull] master from GaijinEntertainment:master#1008

Merged
pull[bot] merged 4 commits into
forksnd:masterfrom
GaijinEntertainment:master
May 18, 2026
Merged

[pull] master from GaijinEntertainment:master#1008
pull[bot] merged 4 commits into
forksnd:masterfrom
GaijinEntertainment:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 18, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

aleksisch and others added 4 commits May 18, 2026 12:12
MCP requires HV. Let's enable HV by default so MCP server will
be available in default builds.

It requires fixing thread-safe bug in libHV:
ithewei/libhv#835

And fixing our CMakeLists for ASAN on linux.
… projection

Closes two `KNOWN PERF GAP` items from PR #2712 + a long-standing qmacro parser
limitation surfaced while implementing them. Net result: spliced order/sort
and select+where chains now beat in-memory SQLite on every headline shape.

Gap 1 — comparator key double-call in `partial_sort`.
  Splice planner inlines pure single-expression keys into a comparator block
  and dispatches to new `top_n_by_with_cmp(arr, K, cmp)` library entry (array
  + iterator variants in `daslib/linq.das`). Direction is encoded by flipping
  the comparator arg order (`_::less(body[v2], body[v1])` for desc); no
  separate `_descending` variant needed, eliminating the secondary wrapper
  lambda the existing desc family adds. Falls back to keyed `top_n_by` when
  the key has side effects or isn't a single-expression lambda.

Gap 2 — projection double-eval in `select + where + terminator`.
  Phase 3d inlined `projection` into `predicate` via peel-substitution; lane
  emitters also cloned `projection` into `valueExpr`, so the projection
  evaluated twice per element on ARRAY / ACCUMULATOR / EARLY_EXIT lanes. The
  where-after-select arm now binds `projection` to a fresh local via a new
  `preConditionStmts` slot (per-element, OUTSIDE the if-wrap), then rewrites
  `projection` to reference that bind — predicate (peel) and valueExpr
  (clone) share the single eval. COUNTER lane is explicitly excluded (no
  body use; extra bind would regress its single-stmt fast path).
  Side-effecty projections still bail to tier 2 (moving them outside the if
  would visibly fire side effects on filter-rejected elements).

Parser bonus — `src/parser/parser_impl.cpp:885`.
  Multi-arg `$($i(a) : T, $i(b) : T) { ... }` qmacro form failed parse with
  `30701: block argument is already declared MACRO TAG` because the parser
  stamped every `$i(...)` in block-arg position with the literal placeholder
  name and dup-checked them before macro tag resolution. Fixed by skipping
  the dup check when `name_at.tag != nullptr` — genuine post-resolution
  dups surface as ordinary local-lookup conflicts during type inference.
  General-purpose; usable by any macro that emits a typed block with N
  tagged-name args.

Tests:
  - 4 new tests in `test_linq_fold_ast.das`: Gap 2 dedup-proof (literal
    `7919` appears exactly once in the spliced body), select+where impure
    bailout + per-element call-count assertion, Gap 1 side-effecting-key
    fallback + correctness.
  - 5 existing AST-shape tests updated to match new emission (top_n_by →
    top_n_by_with_cmp; order_by → order(arr, cmp); order_by_inplace →
    order_inplace).

Benchmarks (100K rows, INTERP):
  - sort_take            m3f 56  → 27 ns/op (2.1×; beats SQL at 38)
  - order_take_desc      m3f 56  → 27 ns/op (2.1×; beats SQL at 38)
  - select_where_order_take m3f 39 → 24 ns/op (1.6×; beats SQL at 36)
  - select_where_sum (NEW) m3 59 / m3f 7 ns/op (8.4× over m3; 5.3× over SQL)
  - select_where_count   m3f 5 ns/op (unchanged — COUNTER lane correctly excluded)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-single-eval

linq_fold: single-eval splice — inline pure keys + dedup select+where projection
@pull pull Bot locked and limited conversation to collaborators May 18, 2026
@pull pull Bot added the ⤵️ pull label May 18, 2026
@pull pull Bot merged commit 1bd56ee into forksnd:master May 18, 2026
@pull pull Bot had a problem deploying to github-pages May 18, 2026 14:58 Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants